home *** CD-ROM | disk | FTP | other *** search
-
-
- Using MS-DOS 3.1 on an IBM PC
-
- by
-
- Mark S Cathcart
-
- Systems Engineer
- Chemical Bank
- 200 Jericho Qaudrangle
- Jericho NY 11753
-
- AUGUST 26,1985.
-
- In an effort to organize my IBM PC XT/370 and its hard disks as well as
- to ease the pains of chaNgi.g from version to version of MS-DOS I have
- spent some time digging into MS-DOS and some of its standard features.
-
- What follows are a number of well known MS-DOS tips as well as some
- undocumented features of some of the MS-DOS components and some uses
- that may not have been thought of. I am not trying to tell you how to
- organize your PC but rather suggest a few things you might consider.
-
- "TRUE REFINEMENT SEEKS SIMPLICITY"
-
- I will be discussing the following topics:
- CONFIG.SYS - SHELL,LASTDRIVE
- COMMAND.COM
- PATHing
- SUBST command
- CHDIR command
- The MS-DOS PROMPT
- ANSI.SYS
- BAT files
- Environment Area
-
- CONFIG.SYS
- ----------
-
- Two important parameters are found in this file (in terms of this
- discussion !) they are SHELL= and LASTDRIVE= . I will discuss them in
- reverse order.
-
- LASTDRIVE= was added in MS-DOS 3.1 as part of the PC Network
- support. You can specify the drive letter representing
- the last drive you wish to access. The importance of
- this parameter in this discussion is that it gives us
- the ability to access upto 21 logical disk drives via
- the SUBST command.
-
-
- Format: LASTDRIVE=n:
-
- where n: is drive A:-Z:
-
- Remarks: There seems to be no restriction on the coding of this
- parameter, you can specify Z: even if you have only one
- diskette drive.
- VM/PC users should be aware however that you should not
- go beyond the letter O: otherwise you will experience
- un-predictable results. This has been reported to IBM
- and has been closed as SUGGESTION for FUTURE
- IMPROVEMENT.
-
-
- SHELL= This parameter tell MS-DOS where to find COMMAND.COM .
- It is generally believed that this file has to reside in
- the root directory of the disk that is booted from, not
- so. There have also been a number of documents/programs
- showing methods of enlarging the MS-DOS environment
- area. At best some of these are risky, at worst they are
- down-right dangerous. You can via the SHELL= parameter
- change the size of the environment area as needed.
-
- Format: SHELL=[n:][path]filename.ext [n:][path] /D /P /F /E:nn
-
- Remarks:
- The first dive-path-filename.ext tells the system where
- to find the initial copy of COMMAND.COM to load.
-
- The second drive-path tells the system where to find the
- COMMAND.COM to reload when required.
-
- /D parameter tells MS-DOS not to executes the
- AUTOEXEC.BAT file at BOOT up time.
-
- /P parameter tells MS-DOS to make the substitution
- permanent.
-
- /F parameter tells MS-DOS to skip the response to the
- interrupt 24H handler message ABORT,RETRY or IGNORE .
-
- /E parameter tells MS-DOS how many paragraphs to set
- aside for the environment area. This can be between 10
- and 62. The Default is /E:10
-
- With the addition of a carefully coded SHELL= statement in the
- CONFIG.SYS file we can now put all files for a given version of MS-DOS
- into a separate sub directory. This is with the exclusion of the IBM
- BIOS/DOS files, which are created by the SYS command or FORMAT with
- with /S parameter.
-
- Also now the drive that you are booting from does not have to contain
- the COMMAND.COM file.
-
- So much for CONFIG.SYS, depending on your level of PC knowledge by now
- you are either bored,confused or want to know more. Stick with me.
-
- "NO MAN IS USELESS, HE CAN ALWAYS SERVE AS A BAD EXAMPLE"
-
- A habit that almost all hard-disk drive users have is to keep their
- files in sub-directories according to file type/use . This can be very
- helpful when trying to locate a file (or program), keeping multiple
- copies of files and even to some extent protecting files from prying
- eyes.
-
- One difficult part of doing this is accessing these files easily and
- being able to execute the programs without typing extensive and lengthy
- path names. One way of executing the programs is to code the
- sub-directory names in the PATH statement.
-
- There is (obviously ??) a problem with this though, you can only have
- one PATH statement, that PATH statement can only be 127 characters in
- length. I soon exceeded that.
-
- Assume for 1 minute that you have some directories named as follows:
-
- C:\DOS31
- C:\PROGRAMS
- C:\PROGRAMS\BAT-AIDS
- C:\PROGRAMS\PASCAL
- C:\PROGRAMS\PASCAL\SOURCE
- C:\PROGRAMS\PASCAL\TUTOR
- C:\PROGRAMS\NEWPROGS
- C:\PROGRAMS\OLDPROGS
- C:\PROGRAMS\PC-GAMES (yes, I do have a few.)
- C:\COMMS
- C:\COMMS\XTALK35
- C:\COMMS\PC-TALK
-
- I have these and many others on the C: disk alone not to mention the D:
- disk or any others I may be using. A quick glance should tell you that
- you cannot possibly PATH to all these subdirectories, let alone any
- more. Or can you ?
-
- As described above you can use the SHELL= parameter to specify upto 26
- drive letters that need not all exist. When used with the SUBST command
- this can be a powerful tool. Lets take a look at the SUBST command.
-
- SUBST n: [n:][path]
-
- n: is a drive that you dont really have hardware for.
-
- [n:][path] is a disk subdirectory that will be searched
- when you specify n:
-
- For example: In the above list of directories the
- C:\PROGRAMS directory is referenced a great deal, we
- could code that:
-
- SUBST P: C:\PROGRAMS
-
- If we then do a DIR P: all the files in that directory
- will be listed. Also the PATH command can now be coded
- as PATH=P:;P:\BAT-AIDS;P:\PASCAL............ etc.
- This avoids needless repetition and allows to a greater
- number of sub directories within the PATH command.
-
- With this method I PATH to 32 directories that all have meaningful
- names. And this leaves my root directory to be used for data files
- only.
-
- This only presents one problem, getting to the subdirectories when you
- want to access the files or do some kind of maintenance to them. This
- is acheived by the CHDIR command in MS-DOS. To get to the subdirectory
- that contains the source for my PASCAL programs I would enter
- CHDIR C:\PROGRAMS\PASCAL\SOURCE which can be a pain if done often.
-
- PC Magazine Volume 4 Number 16 carried an article in its user-to-user
- column describing BATMAKER.BAS a BASIC program that created bat files
- with the name of the last subdirectory in a given path.
-
- From the above example C:\PROGRAMS\PASCAL\SOURCE could be goto by
- typing SOURCE . My implementation OF BATMAKER can be found on the
- ISA-PC RBBS. Mine differs from the one in PC-Magazine in two ways; one
- it is executed from a BAT file that always issues "CHKDSK / V | FIND
- "Dir" > TEMPFILE" and two all the BAT files are kept in another
- subdirectory so that they can be erased before each run of BATMAKER.
-
-
-
-
- If you are an MS-DOS expert by the time you reach this point you will
- trying to decide if you should read any more or quit, to you I say
-
- "PATIENCE IS NOT PASSIVE, ON THE CONTRARY, IT IS CONCENTRATED STRENGTH"
-
- Another hassle when working with many subdirectories is knowing which
- one you are in. The following example of the PROMPT command will solve
- this for you and it will also show you how to set the SCREEN attributes
- in a way that they will be reset following exit from a program (not
- always the case in standard MS-DOS!!).
-
- PROMPT $e[1mReady$e[0m($e[7m$p$e[0m)$e[1m;$d / $t$h$h$h$e[0m$_
- ----- ----- ----- ----- ----- -----
- The $p will display the current directory
- the $d causes the date to be shown
- the $t causes the time to be shown
-
- Most of that should be old hat to you right ?? The rest of the
- information not under-lined is makes the PROMPT a little prettier(?).
- The data under-lined represents escape sequences used to set the color
- and highlighting each time the PROMPT is displayed.
-
- I only have a Mono-chrome monitor and thus have not tested but believe
- the following codes to be true:
-
- $e[0m = Normal $e[1m = Highlight $e[7m = Reverse video
- $e[4m = Underline $e[5m = Blink $e[8m = Dark(invisible)
- $e[30m= Black $e[31m= Red $e[32m= Green
- $e[33m= Yellow $e[34m= Blue $e[35m= Magenta
- $e[36m= Cyan $e[37m= White
-
- You will be able to do much more than this but its upto you to test
- which you find best, the escape sequences are valid upto 49 I think.
- Note that to make use of these escape sequences you must include
- DRIVER=[n:][path]ANSI.SYS in the CONFIG.SYS file.
-
- And now before you go let me quickly talk about BAT files.
-
- BAT FILES
- ----------
-
- These are a few simple tips on writing BAT files, the format and
- operational characteristics of BAT commands changes from release to
- release. Hopefully IBM will realize that this can be an important part
- of MS-DOS and will stop mucking about with it, document it properly and
- who knows, even develop it.
-
- Cause a blank line to be output enter "ECHO. " note that there is a
- period following ECHO, this will not be printed.
-
- Test for positive condition using IF subcommand when a replaceable
- parameter %1 %2 %3 etc. may not have been supplied
-
- if $%1==$START goto START
-
- this statement will execute correctly regardless if %1 has a value or
- not.
-
- Setting and retrieving information via the MS-DOS environment area.
- The environment area is where your PATH, PROMPT and COMSPEC values are
- kept and retrieved by MS-DOS. You can make use of this area as well.
-
- To set issue SET name=value
- To retrieve if $%name%==$YES echo YES
-
- Note that when you SET the value you DON NOT put it % signs but when
- you want to test the value you must include the name in % signs.
-
- Unless you specifically reset the values they will last until you
- re-boot or power off the PC. You should also be aware that you can run
- out of space to set variables, this is especially true if you use any
- memory resident MS-DOS programs such as SIDEKICK, DOSEDIT etc. To
- create more space change or add the /E parameter to the SHELL=
- statement in your CONFIG.SYS as detailed above.
-
- And finally, if you read all the way thru I hope you found this to be
- of some use, remember:
-
- "There are few things more difficult than the art of making advice
- agreeable."
-